// 
package com.hj.entity;

// Generated 2012-4-29 18:09:10 by Hibernate Tools 3.2.2.GA

import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.Version;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.BatchSize;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * AcctGroup generated by hbm2java
 */
@Entity
@Table(name = "acct_group", catalog = "standardweb", uniqueConstraints = @UniqueConstraint(columnNames = "name"))
public class AcctGroup implements java.io.Serializable {

	private Long id;
	private String name;
	private List<AcctUser> acctUsers = new ArrayList<AcctUser>();
	private List<AcctGroupPermission> acctGroupPermissions = new ArrayList<AcctGroupPermission>();

	public AcctGroup() {
	}

	public AcctGroup(String name) {
		this.name = name;
	}

	public AcctGroup(String name, List<AcctUser> acctUsers, List<AcctGroupPermission> acctGroupPermissions) {
		this.name = name;
		this.acctUsers = acctUsers;
		this.acctGroupPermissions = acctGroupPermissions;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "name", unique = true, nullable = false)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "acct_user_group", catalog = "standardweb", joinColumns = { @JoinColumn(name = "group_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "user_id", nullable = false, updatable = false) })
	@BatchSize(size = 10)
	public List<AcctUser> getAcctUsers() {
		return this.acctUsers;
	}

	public void setAcctUsers(List<AcctUser> acctUsers) {
		this.acctUsers = acctUsers;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "acctGroup")
	@BatchSize(size = 10)
	public List<AcctGroupPermission> getAcctGroupPermissions() {
		return this.acctGroupPermissions;
	}

	public void setAcctGroupPermissions(List<AcctGroupPermission> acctGroupPermissions) {
		this.acctGroupPermissions = acctGroupPermissions;
	}

}
